

<?php

//AQUI TÁ ERRADO

Session_start();
if ((!isset($_SESSION['login']))) {
header("Location: Acesso_Negado.php");
}
$db   = mysql_connect ("localhost", "root" ,"");
$basedados = mysql_select_db("redesocial", $db);

echo("<br>");

$login_digi = $_SESSION['login'];

ECHO("Estes sao os usuarios de substancias muito loucas que sao teus amiguinhos: <br><br>");
echo("   <br>");
$query = "select * from usuarios";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result)) {
    if ($login_digi == $row['login']){
        $coduser = $row['cod'];
    }else{
    }
}

$query2 = "select * from amigos";
$result2 = mysql_query($query2);
        
       while ($row2 = mysql_fetch_array($result2)) {
            if (($coduser == $row2[cod_usu1]) || ($coduser == $row2[cod_usu2]))
            echo($row2[cod_usu1] . " eeee "); 
            echo($row2[cod_usu2] . "");
            
            $query = "select * from usuarios WHERE cod = '$row2[cod_usu1]' or '$row2[cod_usu2]'";
                $result = mysql_query($query);

                        while ($row = mysql_fetch_array($result)) {
                       echo($row[nome] . "<br>");
                        }
       }
class Ver_Amigos {
    //put your code here
}
?>
